const Router = require('koa-router')
const { catchError, generateOk } = require('../../lib/check')
const { getAllTabs } = require('../../model/tab')

let tab = new Router()

tab.post('/get', async (ctx) => {
  try {
    const data = getAllTabs()
    ctx.body = generateOk(data.filter((item) => !!item.state))
  } catch (e) {
    catchError(e, ctx)
  }
})

module.exports = tab